package com.lhs.Timer;



import com.lhs.service.blog_post_0Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class BlogIdPoolScheduler {

    @Autowired
    private blog_post_0Service blogCacheService;

    /**
     * 每 10 分钟定时刷新（cron 可按需调整）
     */
    @Scheduled(cron = "0 0/10 * * * ?")
    public void refresh() {
        try {
            log.info("定时触发全量刷新缓存池...");
            blogCacheService.initBlogIdPool();
        } catch (Exception e) {
            log.error("定时刷新异常", e);
        }
    }
}
